# -*-coding:utf-8-*-

import uuid
import hashlib
import sys

count = 10

if len(sys.argv) >= 2: count = int(sys.argv[1])

while count > 0:
    m = hashlib.md5()
    m.update(str(uuid.uuid4()))
    count -= 1
    print m.hexdigest().upper()





import csv

with open('some.csv', 'rb') as f:  # 采用b的方式处理可以省去很多问题
    reader = csv.reader(f)
    for row in reader:
        print row[0], row[1]

import csv

with open('outout.csv', 'wb') as f:  # 采用b的方式处理可以省去很多问题
    writer = csv.writer(f)
    someiterable = [('zjx', 'mj', 'zxq')]
    writer.writerows(someiterable)

with open('some.csv') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        print row['1'], row['2']

import csv

with open('names.csv', 'w') as csvfile:
    fieldnames = ['first_name', 'last_name']
    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
    writer.writeheader()
    writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})
    writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})
    writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})


import pymongo
c = pymongo.MongoClient().bora.test
c.drop()
c.ensure_index('name', unique=True)
d = {'name': 'zjx', 'no': 1}
d2 = {'name': 'mj', 'no': 12}
d3 = {'name': 'mj', 'no': 12}
c.insert(d)
c.insert(d2)
c.insert(d3)
#for a in c.find({'name': {'$in':['zjx', 'mj']}}).limit(1).skip(1):
for a in c.find({'name': {'$in':['zjx', 'mj']}}).sort('name', pymongo.ASCENDING):
    print a
